package BinaryTree;
/**
 * 二叉树的最小深度
 */
import BinaryTree.init.TreeNode;

public class lc111 {
    public int minDepth(TreeNode root) {
        if (root == null) return 0;
        int lefth = minDepth(root.left);
        int righth = minDepth(root.right);
        if (root.left == null) return righth + 1;
        if (root.right == null) return lefth + 1;
        return 1 + Math.min(lefth, righth);
    }
}
